#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>


int Judge_prime(int x) {
    int y = (int)sqrt(x); 
    if (x <= 1) {
        return 0; 
    }
    else if (x == 2 || x == 3) {
        return 1; 
    }
    else if (x % 6 != 1 && x % 6 != 5) {
        return 0; 
    }
    else {
        
        for (int i = 5; i <= y; i += 6) {
            if (x % i == 0 || x % (i + 2) == 0) {
                return 0; 
            }
        }
        return 1; 
    }
}

int main() {
    int num;
    printf("Enter a positive integer: ");
    scanf("%d", &num);

    if (Judge_prime(num)) {
        printf("%d is a prime number.\n", num);
    }
    else {
        printf("%d is not a prime number.\n", num);
    }

    return 0;
}
